package com.sgb.member.ui.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;

import com.sgb.member.BR;
import com.sgb.member.MemberConfig;
import com.sgb.member.R;
import com.sgb.member.databinding.ItemFixedAssetsBinding;
import com.sgb.member.entity.MemberAssetInfoListBean;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;
import com.swgk.core.util.MToast;

import java.util.List;

/**
 * Created by：冯齐 on 2021/1/27 11:50
 * Description：
 */
public class FixedAssetsAdapter extends BaseRecycleAdapter<MemberAssetInfoListBean> {

    public FixedAssetsAdapter(Context context, List<MemberAssetInfoListBean> datas) {
        super(context, R.layout.item_fixed_assets, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final MemberAssetInfoListBean entity) {
        holder.setBinding(BR.viewModel, entity);
        ItemFixedAssetsBinding binding = (ItemFixedAssetsBinding) holder.getmBinding();
        binding.tvCompanyName.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!TextUtils.isEmpty(entity.getCreateCompanyNo())) {
                    MemberConfig.getInstance().startWebsiteInfo(context, entity.getCreateCompanyNo(), 1);
                } else {
                    MToast.showToast(context, "店铺No为空");
                }
            }
        });
    }
}
